import subprocess
import sys

def install_requirements():
    print("正在安装依赖...")
    try:
        subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
        print("依赖安装成功！")
    except subprocess.CalledProcessError:
        print("安装依赖时出错。请检查您的网络连接或尝试手动安装。")
        sys.exit(1)

if __name__ == "__main__":
    install_requirements()